package one.stand.feign;

import one.stand.entity.TokenEntity;
import one.stand.fallback.LoginFallBack;
import one.stand.model.CompanyModel;
import one.stand.model.ResultModel;
import one.stand.request.SendSmsCodeRequest;
import one.stand.request.WxLoginRequest;
import one.stand.response.LoginResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Administrator
 */
@Component
@FeignClient(value = "login-service", fallback = LoginFallBack.class, decode404 = true)
public interface LoginFegin {

    /**
     * 获取登陆地址
     * @return
     */
    @PostMapping("home/getPcLoginImg")
    ResultModel<String> getPcLoginImg(@RequestParam("companyKey") String companyKey);

    /**
     * 登陆验证
     * @param code
     * @param state
     * @return
     */
    @PostMapping("home/pcLoginCallBack")
    ResultModel<LoginResponse> pcLoginCallBack(@RequestParam("code") String code, @RequestParam("state") String state);
    /**
     * 登陆信息验证
     *
     * @param token
     * @return
     */
    @PostMapping("home/getLoginInfo")
    ResultModel<TokenEntity> getLoginInfo(@RequestBody String token);


    /**
     * 登陆验证
     *
     * @param token
     * @return
     */
    @PostMapping("home/loginVerification")
    ResultModel<Boolean> loginVerification(@RequestBody String token);


    /**
     * 短信发送
     * @param request
     * @return
     */
    @PostMapping("home/sendSms")
    ResultModel<Boolean> sendSms(@RequestBody SendSmsCodeRequest request);

    /**
     * 短信登录
     * @param request
     * @return
     */
    @PostMapping("home/crmPcLoginBySms")
    ResultModel<LoginResponse> crmPcLoginBySms(@RequestBody WxLoginRequest request);

    /**
     * 根据电话获取相应公司信息
     * @param request
     * @return
     */
    @PostMapping("home/getCompanyListByPhone")
    ResultModel<List<CompanyModel>> getCompanyListByPhone(@RequestBody SendSmsCodeRequest request);




}
